package com.example.schoolhospitalsystem;



import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;

public class DoctorAppointmentListActivity extends AppCompatActivity {

    private ListView lvAppointments;
    private String doctorId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_doctor_appointment_list);

        // 获取医生ID
        Intent intent = getIntent();
        doctorId = intent.getStringExtra("userId");

        lvAppointments = findViewById(R.id.lv_appointments);

        // 获取今日预约列表
        List<String> appointmentList = getTodayAppointments(doctorId);

        // 设置适配器
        ArrayAdapter<String> adapter = new ArrayAdapter<>(
                this, android.R.layout.simple_list_item_1, appointmentList);
        lvAppointments.setAdapter(adapter);
    }

    private List<String> getTodayAppointments(String doctorId) {
        // 这里应该从数据库获取医生今日的预约列表
        // 简化示例，返回一些模拟数据
        List<String> appointments = new ArrayList<>();
        appointments.add("患者: 张三 (学生) - 08:00-08:30");
        appointments.add("患者: 李四 (教师) - 09:00-09:30");
        appointments.add("患者: 王五 (学生) - 10:00-10:30");
        appointments.add("患者: 赵六 (学生) - 14:00-14:30");
        return appointments;
    }
}